﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Departments.aspx.cs" Inherits="Baitap3.Departments" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="PageHeading" runat="server">
<h1>Departments Page</h1>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:PagingDataConnectionString %>" 
                
        SelectCommand="SELECT [Name], [DepartmentID] FROM [Departments]">
    </asp:SqlDataSource>         
    
            
    <br />
    <div style="margin-left:50px">
    <asp:Label ID="lb_name" runat="server" Text="Choose a department:" CssClass="h2"></asp:Label>
    <br />
    <br />
    <asp:DropDownList ID="ddl_name" runat="server" AutoPostBack="True" 
        DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="DepartmentID" 
        Height="22px" Width="200px">
    </asp:DropDownList>

    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:PagingDataConnectionString %>" 
        
        
        SelectCommand="SELECT [DepartmentID], [Name], [URLPhoto], [URLHomePage] FROM [Departments] WHERE ([DepartmentID] = @DepartmentID)" >       <SelectParameters>
            <asp:ControlParameter ControlID="ddl_name" Name="DepartmentID" 
                PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    </div>
    <div style="margin-left:50px; margin-top: 30px; width: 437px;">
    <asp:Label ID="label_2" runat="server" Text="Department information: " CssClass="h3"></asp:Label>
        <br />
        <br />
    <asp:DataList ID="DataList1" runat="server" DataKeyField="DepartmentID" 
        DataSourceID="SqlDataSource2" RepeatDirection="Horizontal">
        <ItemTemplate>
            <asp:Image ID="Image1" runat="server" style="height: 100px; width:100px" ImageUrl='<%# Eval("URLPhoto") %>' />
            <br />
            <br />
            <br />
            DepartmentID:
            <asp:Label ID="DepartmentIDLabel" runat="server" CssClass="bold" 
                Text='<%# Eval("DepartmentID") %>' />
            <br />
            Name:
            <asp:Label ID="NameLabel" runat="server" CssClass="bold"  Text='<%# Eval("Name") %>' />
            <br />
            HomePage:&nbsp;
            <asp:HyperLink ID="HyperLink1" runat="server" Tesxt='<%# Eval("URLHomePage") %>'
                NavigateUrl='<%# Eval("URLHomePage") %>' Text='<%# Eval("URLHomePage") %>'></asp:HyperLink>
        <br />
        </ItemTemplate>
    </asp:DataList>
    <br />
        <div style="margin-left:3px; margin-top: 20px; width: 416px;">
            <asp:Label ID="lb_delete" runat="server" Text="Delete department:" 
                Font-Size="11pt"></asp:Label>
            <asp:ImageButton ID="ImageButton1" runat="server" 
            ImageUrl="~/images/dep/Actions-window-close-icon.png" 
            onclick="bt_delete_Click" Height="28px" />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Label ID="lb_insert" runat="server" Text="Insert new department:" 
                Font-Size="11pt"></asp:Label>
            <asp:ImageButton ID="ImageButton2" runat="server" 
            ImageUrl="~/images/dep/edit-icon.png" onclick="bt_edit_Click" Height="30px" />
        </div>    
    </div>
    <div style="margin-left:50px; margin-top: 50px">
    <asp:Label ID="label1" runat="server" 
            Text="Insert information for new department: " CssClass="h3" Visible="False"></asp:Label>
    <asp:Panel ID="Panel1" runat="server" Height="265px" Visible="False" Width="484px">
        <br />
        <br />
        <asp:Label ID="Label3" runat="server" Text="Department Name:" Font-Size="11pt"></asp:Label>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:TextBox ID="txt_Name" runat="server" Width="260px" AutoPostBack="True"></asp:TextBox>
        <br />
        <br />
        <br />
        <asp:Label ID="Label4" runat="server" Text="HomePage:" Font-Size="11pt"></asp:Label>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<asp:TextBox 
            ID="txt_HomePage" runat="server" 
            Width="261px" AutoPostBack="True"></asp:TextBox>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <br />
        <br />
        <br />
        <asp:Label ID="Label5" runat="server" Text="URLPhoto:" Font-Size="11pt"></asp:Label>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:TextBox ID="txt_Photo" runat="server" Width="260px" AutoPostBack="True"></asp:TextBox>
        <br />
        <br />
        <asp:Label ID="Label6" runat="server" Text="ShowControl:" Font-Size="11pt"></asp:Label>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:TextBox ID="txt_ShowControl" runat="server" Width="261px"></asp:TextBox>
        <br />
        <br />
        <br />
        <br />
        &nbsp;<asp:Label ID="Label7" runat="server" Text="Update your editing:" 
            Font-Size="11pt"></asp:Label>
        &nbsp;
        <asp:ImageButton ID="bt_Submit" runat="server" 
            ImageUrl="~/images/dep/form_submit.gif" onclick="bt_Submit_Click1" 
            PostBackUrl="~/Departments.aspx" AlternateText="Update" Width="71px"/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Label ID="Label8" runat="server" Text="Insert new item:" Font-Size="11pt"></asp:Label>
        &nbsp;&nbsp;
        <asp:ImageButton ID="bt_insert" runat="server" AlternateText="Insert" 
            Height="30px" ImageUrl="~/images/dep/Plus-icon.png" onclick="bt_Insert_Click" 
            Width="47px" />
    </asp:Panel>
    </div>        
</asp:Content>
